@using Blog.MVP.Blazor.SSR.Models

@inherits LayoutComponentBase


<div>
    <div class="form-group">
        <label>标题</label>
        <input @bind="BlogArticle.btitle" class="form-control" />
    </div>
    <div class="form-group">
        <label>分类</label>
        <select @bind="BlogArticle.bcategory" class="form-control">
        <option value="MVP_2024">MVP_2024</option>
            <option value="-----">------</option>
            <option value="MVP_aspnetcore_2023">MVP_aspnetcore_2023</option>
            <option value="MVP_java_2023">MVP_java_2023</option>
            <option value="-----">------</option>
            <option value="MVP_aspnetcore_2022">MVP_aspnetcore_2022</option>
            <option value="MVP_java_2022">MVP_java_2022</option>
            <option value="-----">------</option>
            <option value="MVP_aspnetcore_2021">MVP_aspnetcore_2021</option>
            <option value="MVP_java_2021">MVP_java_2021</option>
            <option value="MVP_bcvp_bloghigh">MVP_bcvp_bloghigh</option>
            <option value="MVP_bcvp_abp">MVP_bcvp_abp</option>
            <option value="-----">------</option>
            <option value="MVP_aspnetcore_2020">MVP_aspnetcore_2020</option>
            <option value="MVP_azure_2020">MVP_azure_2020</option>
            <option value="MVP_ids4_2020">MVP_ids4_2020</option>
            <option value="MVP_blazor_2020">MVP_blazor_2020</option>
            <option value="MVP_activity_2020">MVP_activity_2020</option>
            <option value="MVP_bcvp_2020">MVP_bcvp_2020</option>
        </select>
    </div>
    <div class="form-group">
        <label>外链</label>
        <input @bind="BlogArticle.bsubmitter" class="form-control" />
    </div>
    <div class="form-group">
        <label>副标题</label>
        <input @bind="BlogArticle.bcontent" class="form-control" />
    </div>
    <div class="form-group">
        <label>阅读</label>
        <input @bind="BlogArticle.btraffic" class="form-control" />
    </div>

    <button class="btn btn-primary" @onclick="TrySave">
        保存
    </button>

    <CancelBtn Name="取消"></CancelBtn>
</div>

@code{

    [Parameter]
    public BlogArticle BlogArticle { get; set; }
    [Parameter]
    public EventCallback<BlogArticle> OnSaveCallback { get; set; }

    protected override Task OnInitializedAsync()
    {
        if (BlogArticle == null)
        {
            BlogArticle = new BlogArticle();
            BlogArticle.bcategory = "技术博文";
        }

        return Task.CompletedTask;
    }

    private void TrySave()
    {
        OnSaveCallback.InvokeAsync(BlogArticle);
    }
}
